﻿using System;
using System.Collections.Generic;
using System.Text;

namespace C11_Ex01_5
{
    public class Program
    {
        public static void Main()
        {
            string input;
            int numberOfLowerCaseChars = 0;
            int numberOfUpperCaseChars = 0;
            int numberOfDigits = 0;
            int numberOfSpaces = 0;

            System.Console.WriteLine("Please enter a line.");
            input = System.Console.ReadLine();

            for (int i = 0; i < input.Length; i++)
            {
                if(char.IsLower(input[i]))
                {
                    numberOfLowerCaseChars++;
                }
                else if (char.IsUpper(input[i]))
                {
                    numberOfUpperCaseChars++;
                }
                else if (char.IsDigit(input[i]))
                {
                    numberOfDigits++;
                }
                else if (input[i] == ' ')
                {
                    numberOfSpaces++;
                }
            }

            System.Console.WriteLine(string.Format(
                "The input string contains:{4}{0} lower English character{6},{4}{1} upper English character{7},{4}{2} digit{8},{4}and {3} space{5}.",
                numberOfLowerCaseChars,
                numberOfUpperCaseChars,
                numberOfDigits,
                numberOfSpaces,
                Environment.NewLine,
                numberOfSpaces == 1 ? string.Empty : "s",
                numberOfLowerCaseChars == 1 ? string.Empty : "s",
                numberOfUpperCaseChars == 1 ? string.Empty : "s",
                numberOfDigits == 1 ? string.Empty : "s"));

            System.Console.Write("Press any key to continue . . . ");
            System.Console.ReadLine();
        }
    }
}
